import URL from './url.js'
import base64 from 'base-64'
export default class Set {
    constructor() {

    }
    async get_New_Version() {
        try {
            var response = await fetch(URL.checkNew_Version);
            return response.text();
        } catch (error) {
            console.log("CheckNew", error);
        }
        return null;
    }
    async alertPassword(username,oldPassword,newPassword) {
        // alert(username+ base64.encode(oldPassword)+'----'+base64.encode(newPassword));
        try {
            var response = await fetch(URL.modifyPassword_URL, {
                method: 'POST',
                headers: {
                    'x_domainid': '3',
                    'x_account': 'bks',
                    'x_secret': 'YmtzQDIwMTMwNjI1',
                    'u_username': username,
                    'u_old_password': base64.encode(oldPassword),
                    'u_new_password':base64.encode(newPassword)
                }
            });
            return response.text();
        } catch (error) {
            console.log("setting_ModifyPassword", error);
        }
        return null;
    }
}